﻿<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%
    //查询员工信息数据，返回明细数据
    Map<String, Object> apidatas = new HashMap<String, Object>();
    BaseBean baseBean = new BaseBean();
    JSONObject dataJson = new JSONObject();
    String ygxm = Util.null2String(request.getParameter("ygxm"));
    baseBean.writeLog(">>>>>getYgxx_Ajax.jsp>>>>>ygxm=" + ygxm);
    String code = "SUCCESS";
    String message = "";
    RecordSet rs = new RecordSet();
    try {
        JSONArray dt12List = new JSONArray();
        JSONArray dt14List = new JSONArray();
        JSONArray dt1List = new JSONArray();
        JSONArray dt2List = new JSONArray();
        JSONArray dt13List = new JSONArray();
        JSONArray dt3List = new JSONArray();
        JSONArray dt7List = new JSONArray();
        JSONArray dt8List = new JSONArray();
        JSONArray dt5List = new JSONArray();
        JSONArray dt9List = new JSONArray();
        JSONArray dt4List = new JSONArray();
        JSONArray dt15List = new JSONArray();
        rs.executeQuery("select scopeid,seqorder from CUS_FIELDDATA where scopeid in (5,23,9,8,4,10,7,11,13,12,17,24) and id=?", ygxm);
        while (rs.next()) {
            String  seqorder = Util.null2String(rs.getString("seqorder"));
            String  scopeid = Util.null2String(rs.getString("scopeid"));
            JSONObject dtlJson = new JSONObject();
            dtlJson.put("seqorder", seqorder);
            dtlJson.put("ygxm", ygxm);
            switch (scopeid){
                case "5": dt12List.add(dtlJson);break;
                case "23": dt14List.add(dtlJson);break;
                case "9": dt1List.add(dtlJson);break;
                case "8": dt2List.add(dtlJson);break;
                case "4": dt13List.add(dtlJson);break;
                case "10": dt3List.add(dtlJson);break;
                case "7": dt7List.add(dtlJson);break;
                case "11": dt8List.add(dtlJson);break;
                case "13": dt5List.add(dtlJson);break;
                case "12": dt9List.add(dtlJson);break;
                case "17": dt4List.add(dtlJson);break;
                case "24": dt15List.add(dtlJson);break;
                default:break;
            }

        }
        dataJson.put("dt12List", dt12List);
        dataJson.put("dt14List", dt14List);
        dataJson.put("dt1List", dt1List);
        dataJson.put("dt2List", dt2List);
        dataJson.put("dt13List", dt13List);
        dataJson.put("dt3List", dt3List);
        dataJson.put("dt7List", dt7List);
        dataJson.put("dt8List", dt8List);
        dataJson.put("dt5List", dt5List);
        dataJson.put("dt9List", dt9List);
        dataJson.put("dt4List", dt4List);
        dataJson.put("dt15List", dt15List);
    } catch (Exception e) {
        e.printStackTrace();
        code = "SYSTEM_INNER_ERROR";
        message = "程序内部异常";
    }
    apidatas.put("code", code);
    apidatas.put("data", dataJson);
    apidatas.put("message", message);
    out.print(JSONObject.toJSONString(apidatas));
%>

